package net.ibizsys.eclipse.studio.xml;

import net.ibizsys.eclipse.studio.util.StringKit;

/**
 * 部件
 * 
 * @author <a href='http://www.weibo.com/xjtoo' target='_blank'>Enmaai</a>
 */
public class IBizControl extends IBizSearchableNode
{
	public static final String NODE_PSCONTROL = "PSCONTROL";
	/**
	 * 类型
	 */
	public static final String ATTR_TYPE = "TYPE";

	private String type;

	@Override
	protected void initAttribute(String name, String value)
	{
		if (StringKit.IsEqual(ATTR_TYPE, name, true))
		{
			this.type = value;
			return;
		}

		super.initAttribute(name, value);
	}

	public String getType()
	{
		return type;
	}

	public String getIcon()
	{
		if (StringKit.IsEqual("GRID", getType(), true))
		{
			return "icons/grid.png";
		} else if (StringKit.IsEqual("SEARCHFORM", getType(), true))
		{
			return "icons/form.png";
		} else if (StringKit.IsEqual("FORM", getType(), true))
		{
			return "icons/form.png";
		} else if (StringKit.IsEqual("TOOLBAR", getType(), true))
		{
			return "icons/toolbar.png";
		}
		return "icons/form.png";
	}

	@Override
	public String getText()
	{
		return getType();
	}
}
